function plotEEG(y, samplingRate, spindles, ...
                 plotTitles, titleText, formats, fileName, append, filtered)
             
global PLOT_FOR_WEB 
PLOT_FOR_WEB  = false;
                 
if(nargin <= 8)	
	filtered(1:size(y, 2)) = false;
end

x = getXAxisData(samplingRate);

fh = createEEGFigure(x, y, spindles, plotTitles, titleText, filtered);

failIfFalse(isscalar(append) && islogical(append), 'append should be a logical value');


if(~append)    
    failIfFalse(iscellstr(formats), 'formats should be a string cell array');

    for i = 1:size(formats, 2)
        exportFigure(fh, formats{i}, fileName);
    end
    
    delete(fh);
    return;
end

appendToPs(fh, fileName);

delete(fh);

